package com.itheima.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.constant.RedisConstant;
import com.itheima.dao.AgeDao;
import com.itheima.dao.SetmealDao;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import redis.clients.jedis.JedisPool;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 体检套餐服务
 */

@Service(interfaceClass = AgeService.class)
@Transactional
public class AgeServiceImpl implements AgeService {
    @Autowired
    private AgeDao ageDao;
    @Autowired
    private JedisPool jedisPool;

    public List<Map> getAgeReport() {

        Map<String,Object> data = new HashMap<>();
        List<String> ageNames = new ArrayList<>();
        data.put("ageNames",ageNames);
        List<Map> ageCount = new ArrayList<>();
        Integer count1 =  ageDao.countType1();
        Integer count2 =  ageDao.countType2();
        Integer count3 =  ageDao.countType3();
        Integer count4 =  ageDao.countType4();
        Integer count5 =  ageDao.countType5();
        Integer count6 =  ageDao.countType6();
        Map map1 = new HashMap();
        map1.put("name","婴儿");
        map1.put("value",count1);
        Map map2 = new HashMap();
        map2.put("name","少儿");
        map2.put("value",count2);
        Map map3 = new HashMap();
        map3.put("name","青少年");
        map3.put("value",count3);
        Map map4 = new HashMap();
        map4.put("name","青年");
        map4.put("value",count4);
        Map map5 = new HashMap();
        map5.put("name","中年");
        map5.put("value",count5);
        Map map6 = new HashMap();
        map6.put("name","老年");
        map6.put("value",count6);
        ageCount.add(map1);
        ageCount.add(map2);
        ageCount.add(map3);
        ageCount.add(map4);
        ageCount.add(map5);
        ageCount.add(map6);
        return ageCount;
    }
}
